<template name="SelectUsersModal">
  <div class="modal fade full-screen" id="SelectUsersModal">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">&times;</button>
          <div class="modal-title">
            {{#if selectedList}}
              {{_ "app_selected_users" count=selectedUsers.length}}
              <a href="#" class="btn-toggle-list">{{_ "app_select_users"}}</a>
            {{else}}
              {{_ "app_select_users"}}
              {{#with selectedUsers}}
                <a href="#" class="btn-toggle-list">{{_ "app_selected_users" count=length}}</a>
              {{/with}}
            {{/if}}
          </div>
        </div>
        <div class="modal-body scroll-box no-padding">
          {{#unless selectedList}}
            <div class="input-group" style="padding: 10px;">
              <input type="search" value="{{search}}" id="user-search" class="form-control" placeholder="{{_ 'placeholder_search'}}">
              <span class="input-group-btn">
                <button class="btn btn-default" type="button" id="btn-cancel-search-users">{{_ 'app_action_cancel'}}</button>
              </span>
            </div>
          {{/unless}}
          <ul class="list-group threads">
            {{#each users}}
              <li class="list-group-item thread clearfix btn-toggle-select {{#if selected}}active{{/if}}">
                <div class="thread-icon">
                  {{> avatar user=this shape="circle" size="small"}}
                </div>
                <div class="thread-title">
                  <div class="thread-subject text-ellipsis">{{name}} <small class="text-muted">{{title}}</small></div>
                  <div class="message-summary text-ellipsis text-muted">{{email}}</div>
                </div>
              </li>
            {{/each}}
          </ul>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">{{_ 'app_action_discard'}}</button>
          <button type="button" class="btn btn-primary" id="btn-confirm-selected">{{_ "app_action_confirm"}}</button>
        </div>
      </div>
    </div>
  </div>
</template>
